<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .one{
      /* background-color:#ff5456; */
      width: 100px;
      height: 100px;
      margin-top: 5px;
    }
  </style>
</head>
<body>
  <div class="one"></div>
  <div class="one"></div>
  <div class="one"></div>
  <div class="one"></div>
  <div class="one"></div>
  <script>
    
      var boxs=document.querySelectorAll('.one')
      for(var i=0;i<boxs.length;i++){
        var a=Math.random().toString(16).slice(2,8)
        boxs[i].style.backgroundColor="#"+a
        console.log(a);
      }
      
    
    
  </script>
</body>
</html>